local priority = 3

EntitySystem.updatesystem("audio", priority, function(dt) 
     
  for e in pairs(EntitySystem.query("soundEffect")) do
    --Have we created the audio from the data yet?
    if e.audio.source == nil then
      e.audio.source = love.audio.newSource(e.audio.sound)
    end
      
    --Leave it alone if it's playing
    if e.audio.isPlaying then
    else
      --Otherwise set the volume, whether or not it should loop, and play it
      e.audio.source:setVolume(e.audio.volume)
      e.audio.source:setLooping(e.audio.loop)
      love.audio.play(e.audio.source)
      e.audio.isPlaying = true
    end
  end
end)
  